package com.naiterui.ehp.bs.doctor.dao.impl;

import com.naiterui.ehp.bp.domain.education.EduAnalysis;
import com.naiterui.ehp.bp.domain.education.EduInfo;
import com.naiterui.ehp.bs.doctor.dao.IEduDao;
import com.naiterui.ehp.bs.doctor.repository.IEduAnalysisRepository;
import com.naiterui.ehp.bs.doctor.repository.IEduRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class AdEduDaoImpl  implements IEduDao {


    @Autowired
    private IEduRepository eduRepository;

    @Autowired
    private IEduAnalysisRepository eduAnalysisRepository;

    @Override
    public List<EduInfo> getEduInfoByUrl(String eduUrl) {
        return eduRepository.findByEduUrlAndIsAvailable(eduUrl, EduInfo.IS_AVAILABLE_TRUE);
    }

    @Override
    public List<EduAnalysis> getReadCount(Long id, Long doctorId) {
        return eduAnalysisRepository.findByEduIdAndDoctorId(id, doctorId);
    }

}
